import { configureStore, combineReducers } from "@reduxjs/toolkit";
import user from "./modules/user";
import persistReducer from 'redux-persist/es/persistReducer';
import persistStore from 'redux-persist/es/persistStore';
import persistConfig from './persistConfig';

const rootReducer = combineReducers({
    user
})
const persistedReducer = persistReducer(persistConfig, rootReducer);

export const store = configureStore({
    reducer: persistedReducer,
    middleware: (getDefaultMiddleware) =>
        getDefaultMiddleware({
            serializableCheck: false,
        }),
})

// export default store
export const persistor = persistStore(store);